/**
 * 上海交大--鹏越惊虹
 */
package org.infosec.lc.exercises.jdk6Features;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

/**
 * 作者：林超 <br>
 * 时间：2011-12-26 下午03:57:02 <br>
 * 完整类名：org.infosec.lc.exercises.jdk6Features.ScriptEngine <br>
 * 说明：对脚本语言的支持如: ruby, groovy, javascript.<br>
 * <br>
 * POM.xml<br>
 * <br>
 */
public class ScriptEngines {

	/**
	 * 说明：<br>
	 * 参数：<br>
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		ScriptEngineManager manager = new ScriptEngineManager();

		ScriptEngine engine = manager.getEngineByExtension("js");

		try {
			engine.eval("println('dfgdfgsfgsdf')");
			System.out.println(engine.eval("1+(2+5)/2"));
			System.out.println(Math.pow(2, 3));
		} catch (ScriptException e) {
			e.printStackTrace();
		}

	}

}
